/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rentaldb;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Pop
 */
@Entity
@Table(name = "tenant")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tenant.findAll", query = "SELECT t FROM Tenant t"),
    @NamedQuery(name = "Tenant.findByTenantId", query = "SELECT t FROM Tenant t WHERE t.tenantId = :tenantId"),
    @NamedQuery(name = "Tenant.findByFname", query = "SELECT t FROM Tenant t WHERE t.fname = :fname"),
    @NamedQuery(name = "Tenant.findByLname", query = "SELECT t FROM Tenant t WHERE t.lname = :lname"),
    @NamedQuery(name = "Tenant.findByEmail", query = "SELECT t FROM Tenant t WHERE t.email = :email"),
    @NamedQuery(name = "Tenant.findByHomePhone", query = "SELECT t FROM Tenant t WHERE t.homePhone = :homePhone"),
    @NamedQuery(name = "Tenant.findByMobilePhone", query = "SELECT t FROM Tenant t WHERE t.mobilePhone = :mobilePhone"),
    @NamedQuery(name = "Tenant.findByWorkPhone", query = "SELECT t FROM Tenant t WHERE t.workPhone = :workPhone"),
    @NamedQuery(name = "Tenant.findByAddress", query = "SELECT t FROM Tenant t WHERE t.address = :address"),
    @NamedQuery(name = "Tenant.findByCity", query = "SELECT t FROM Tenant t WHERE t.city = :city"),
    @NamedQuery(name = "Tenant.findByState", query = "SELECT t FROM Tenant t WHERE t.state = :state"),
    @NamedQuery(name = "Tenant.findByZip", query = "SELECT t FROM Tenant t WHERE t.zip = :zip")})
public class Tenant implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tenant_id")
    private Integer tenantId;
    @Column(name = "fname")
    private String fname;
    @Column(name = "lname")
    private String lname;
    @Column(name = "email")
    private String email;
    @Column(name = "home_phone")
    private String homePhone;
    @Column(name = "mobile_phone")
    private String mobilePhone;
    @Column(name = "work_phone")
    private String workPhone;
    @Column(name = "address")
    private String address;
    @Column(name = "city")
    private String city;
    @Column(name = "state")
    private String state;
    @Column(name = "zip")
    private Integer zip;
    @OneToMany(mappedBy = "tenantid")
    private Collection<Payment> paymentCollection;
    @OneToMany(mappedBy = "tenantid")
    private Collection<Lease> leaseCollection;

    public Tenant() {
    }

    public Tenant(Integer tenantId) {
        this.tenantId = tenantId;
    }

    public Integer getTenantId() {
        return tenantId;
    }

    public void setTenantId(Integer tenantId) {
        this.tenantId = tenantId;
    }

    public String getFname() {
        return fname;
    }

    public void setFname(String fname) {
        this.fname = fname;
    }

    public String getLname() {
        return lname;
    }

    public void setLname(String lname) {
        this.lname = lname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getHomePhone() {
        return homePhone;
    }

    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getWorkPhone() {
        return workPhone;
    }

    public void setWorkPhone(String workPhone) {
        this.workPhone = workPhone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Integer getZip() {
        return zip;
    }

    public void setZip(Integer zip) {
        this.zip = zip;
    }

    @XmlTransient
    public Collection<Payment> getPaymentCollection() {
        return paymentCollection;
    }

    public void setPaymentCollection(Collection<Payment> paymentCollection) {
        this.paymentCollection = paymentCollection;
    }

    @XmlTransient
    public Collection<Lease> getLeaseCollection() {
        return leaseCollection;
    }

    public void setLeaseCollection(Collection<Lease> leaseCollection) {
        this.leaseCollection = leaseCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tenantId != null ? tenantId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tenant)) {
            return false;
        }
        Tenant other = (Tenant) object;
        if ((this.tenantId == null && other.tenantId != null) || (this.tenantId != null && !this.tenantId.equals(other.tenantId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "rentaldb.Tenant[ tenantId=" + tenantId + " ]";
    }
    
}
